#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read() {
    int f=0,t=0;
    char c=getchar();
    while(!isdigit(c)) t|=(c=='-'),c=getchar();
    while(isdigit(c)) f=(f<<3)+(f<<1)+c-48,c=getchar();
    return t?-f:f;
}
void write(int x) {
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar('0'+x%10);
}
signed main(){
	freopen("tree.in","r",stdin);
	freopen("tree.out","w",stdout);
	int t=read();
	int num=20000000/t;
	while(t--){
		int n=read();
		if(n==0){write(2),cout<<'\n';continue;}
		int ans=n+2,x=(int)sqrt(n);
		if(n%2==0){
			int i=n/2;
			if((n%i)%2==i%2||n%i==0)
				ans=min((n+i-1)/i+i+1,ans);
		}
		for(int i=max(1ll,x-num);i<=x+1;i++){
			if((n%i)%2==i%2||n%i==0)
			ans=min((n+i-1)/i+i+1,ans);
		}
		write(ans),cout<<'\n';
	}
	return 0;
}
/*
(n)*(n-1)/2>=4*m 
n*n/8-1/8*n>=m
*/ 
